
define(function (require, exports, module) {
    "require:nomunge,exports:nomunge,module:nomunge";
    var $ = require("jquery"),
        forimg = require("forimg")
    ;
    
    var $page = $("#page");
    var slide = function () {
            $page.find(".prod_slide_01").each(function () {
                var $this = $(this),
                    m = parseInt(Math.random() * 200) + 3000
                ;
                    new forimg.slide({
                        forImgBoxEle: $this.find('.prod_bd'),
                        forImgBoxListEle: ".prod_list",
                        forImgItemEle: ".prod_item",
                        interval: m,
                        callback: function () {
                            var _this = this,
                                _box = this.forImgBox,
                                length = this.forImgItem.length,
                                i = 4
                            ;

                            if (length > i) {
                                $this.on("click", ".prev", function () {
                                    _this.prev();
                                    return false;
                                });
                                $this.on("click", ".next", function () {
                                    _this.next();
                                    return false;
                                });

                                this.automatic(true);
                            }

                        }
                    });
            });
    };

    var init = function () {
        var $page = $("#page");


        
        slide();

        
        
        bind();
    };

    var bind = function () {
        var $page = $("#page");
        $page.find(".tab_box").children('a').on("click", function () {
            var $this = $(this),
                $index = $this.index(),
                $health_main = $this.closest('.health_main'),
                $health_info = $health_main.find(".health_info");
            $this.addClass('cur').siblings().removeClass('cur');
            $health_info.find('.prod_slide').eq($index).addClass("prod_slide_01").siblings().removeClass("prod_slide_01");
            slide();
        });

    };

    init();


   
});
